Log In  
[back to top]


When I'm making games or tweetcarts, I often adjust numbers just a tiny bit, then rerun the whole game. e.g. I change the player speed by 0.1, then change it back, then try 0.05...

This is a bit slow, so here's a library I made to help me do it faster. I also find it useful for analyzing other people's tweetcarts -- if I can easily adjust the values they use, I can quickly figure out what they mean

setup

  • load #twiddler
  • copy the knobs.lua + helpers tabs into your game
  • use kn[1], kn[2], ... kn[8] in place of any number
  • add twiddler() to the end of your _draw function

Now, run your code:

  • press tab and adjust the values (see "controls" below)
  • press tab again -- the values will be copied to your clipboard
  • paste the values into the start of your code to save them

example 1

Start with a tweetcart you want to study. For example, this one by 2DArray: https://twitter.com/2DArray/status/1492566780451205120


[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=119729#p)
10
1 comment



Cart #mine1k-0 | 2022-10-09 | Code ▽ | Embed ▽ | No License
22

A demake of the classic minesweeper.

The game cartridge is just 1024 bytes -- see https://gist.github.com/pancelor/a3aadc5e8cdf809cf0a4972ac9598433 for some lightly commented source code

RULES / CONTROLS:

  • left click to reveal a tile
    • if you hit a mine, you lose
    • revealed tiles will show a number, telling how many of their 8 neighbors are mines
  • right click to flag a tile
  • reveal all non-mine tiles to win!
  • click the smiley face to restart

TIPS

  • left click + right click (simultaneous) to auto-reveal neighbors, if the number of nearby flags matches the number on the tile you clicked
  • mines left and a timer are displayed in the top corners

[ Continue Reading.. ]

22
4 comments



When exporting a game to a binary format (.exe, etc), the manual says:

> To include an extra file in the output folders and archives, use the -E switch:

> > EXPORT -E README.TXT MYGAME.BIN

I tried this (pico8 game.p8 -export "-f game.bin -e examples/ -e samples/") but it doesn't include those subfolders. If I -e examples/kick.pcm, then that file is included, but it's included at the top level, and not in an "examples" subfolder

Am I doing this wrong somehow? I assume this just isn't supported (yet? fingers crossed)

1 comment



Cart #imhungry-0 | 2022-04-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

> Vous contrôlez un petit rennes qui doit attraper le plus de nourriture possible, il s'agit de pain et de mûres. Plus vous attrapez de, plus la nourriture va vite et plus il est compliqué de l'attraper. En haut à droite, vous verrez qu'il y a votre tableau de bord, chaque aliment pêché vaut un point. Et en haut à gauche, il y a un panneau qui vous montre combien d'aliments vous n'avez pas attrapés. Attention ! au bout d'une dizaine d'aliments non attrapés vous perdez et le jeu affiche alors « GAME OVER ! », alors il faut appuyer sur enter pour recommencer.

> Les commandes sont : la flèche droite pour se déplacer vers la droite, la flèche gauche pour se déplacer vers la gauche et la flèche vers le haut pour sauter. C'est si simple !

[ Continue Reading.. ]

2
1 comment



I hit this bug while working on a tweetcart:

?"\*6a"  -- prints 6 'a's    (expected)
?"\*6\"" -- prints 6 quotes  (expected)
?"\*6\n" -- prints 1 newline (unexpected!)
?"\n"    -- prints 1 newline (expected)
1 comment



here's a demo cart showing off some different ways to handle input in grid-based games:

Cart #hojohiyomu-1 | 2022-02-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
46

controls:

  • move around with the arrow keys
  • change "chapters" in the pause menu (enter + arrow keys)
  • slow down the game speed (in the later chapters) in the pause menu

I made this cart as a companion to a blog post about input buffering

46
6 comments



@zep o/

A weird bug has been messing with me recently: pico-8 keeps telling me I have "unsaved changes" when I'm pretty sure I don't. I caught the bug on camera this time:

I don't know how to reproduce it; I tried adding a new tab and messing with the text cursor position (since I wondered if this had something to do with the fix for https://www.lexaloffle.com/bbs/?tid=39379 ) and soon after I was able to trigger the bug. But I was able to trigger the bug without even opening up the code editor -- all I did was load cart1 load cart2 load cart1 over and over again until it said "unsaved changes". strange

Jump to 1:12 and 1:24 in the video to see me trigger the bug two separate times. (the video description has a few other timestamps too)


I'm worried I'll stop trusting that message and accidentally lose real changes!

I think this bug is new as of 0.2.4b; I don't remember it happening beforehand.

1 comment



Cart #lasal-1 | 2022-01-19 | Code ▽ | Embed ▽ | No License
16

A short celeste map mod. It's built as a bit of a puzzle, meant to teach you one specific thing about the game's mechanics.

This doesn't require any advanced speedrunning tech (spike clips, corner jumps, etc) -- executing the intended solutions should be possible for anyone who's beaten celeste classic once or twice.

If you're trying something that seems too hard or only barely possible, try looking for alternatives!

controls

  • arrow keys / Z / X: move / jump / dash
  • E: toggle screenshake

credits

celeste classic: maddy thorson + noel berry

smalleste: a token-optimized version of classic celeste that I used as a starting point

[ Continue Reading.. ]

16
10 comments



demo cart

This demo shows off the interface. To use bigmap in your game, see "setup" below.

Cart #bigmap_demo-1 | 2022-01-18 | Code ▽ | Embed ▽ | No License
47

motivation

The recent 0.2.4 release added support for larger maps:

> Similar to gfx memory mapping, the map can now be placed at address 0x8000 and above (in increments of 0x100). This gives 4 times as much runtime space as the default map, and an additional POKE is provided to allow customisable map sizes.

Larger maps are now possible, but it's difficult to get them into memory -- the built-in map editor only works with vanilla-sized maps.

This cart is a full map editor that makes it easy to make these larger maps!

[ Continue Reading.. ]

47
15 comments



TL;DR

Run load #prof in your local PICO-8 console, then edit the last tab with some code you want to measure:

prof{
  locals={9},         -- args to pass each function (optional)
  function(x)
    local _=sqrt(x)   -- code snippet 1
  end,
  function(x)
    local _=x^0.5     -- code snippet 2
  end,
}

Run the cart: it will tell you exactly how many cycles it takes to run each code snippet.


OVERVIEW

This tool measures precisely how many cycles it takes to run arbitrary snippets of code. I use it all the time when I'm trying to figure out the fastest way to write an algorithm. For example, it's massively helpful to know the fastest way to calculate abs(x) in a modular synthesizer that needs to run this operation tens of thousands of times per second.

For context, PICO-8 runs at 8 million cycles per second. This number is unimaginably large and yet also hundreds of times slower than most desktop computers. To keep things in perspective, I like to remember that 1400 cycles is equal to 1% of your CPU budget each frame (at 60 fps -- 8*1024*1024/60/100 = 1398.1)

[ Continue Reading.. ]

17
4 comments



Cart #linecook-3 | 2023-10-30 | Code ▽ | Embed ▽ | No License
5

these busy birds will eat almost anything that falls into their gullet -- what will you feed them? they have their preferences, but people food beats bird food any day of the week!

a difficult, chaotic arcade game. now with local multiplayer support! also available on itch.

controls:

  • left / right: move
  • x / up: grab
  • ESDF: movement keys for player 2

features

  • 4 difficulty modes: "easy", medium, hard, and practice
  • 3 different control schemes:
    • solo
    • local multiplayer
    • two-handed singleplayer
  • 4 challenging maps for 4 different flavors of gameplay

[ Continue Reading.. ]

5
1 comment



0.2.4 has been released, and we now have an extra segment of memory to play with from 0x8000 to 0xffff. That's 32K, or 0x8000 bytes. A spritesheet takes up 0x2000 bytes... so we could stuff 4 extra spritesheets in there!

I've created a system where you can call my custom function cspr the same way you would normally call spr, and everything "just works". The difference is, cspr can handle up to 1024 sprites instead of the standard 256-sprite-limit of spr. (also, cspr is a bit slower (but not much!) than spr, because it has to manage a cache)

Here's a demo that uses 4 full spritesheets; search the code for "cspr" to see how easy it is to use, once you've set it up!

Cart #hefafanino-4 | 2021-12-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
26

[ Continue Reading.. ]

26
11 comments



I've hit a really bizarre error; my code has no coroutines, but it fails with "attempt to yield from outside a coroutine"

I've simplified it down as much as I could; while removing unrelated cruft (e.g. the sort function from my new project template that I wasn't actually using anywhere) the bug would arbitrarily appear or disappear.

The bug will either get triggered 100% of the time or 0% of the time when you run the cart, but its presence or disappearance arbitrarily changes depending on what other unrelated code there is in the cart.

For example, tab 0 is 15K of function foo() end repeated over and over again. They're commented out right now, and the bug is present. If you comment them back in, the bug disappears.

Commenting out the body of pqb (which prints many many u64 objects) seems to remove the bug for good (no matter how many foos I comment in or out). I'm not too experienced with metatables; I think I may be at fault for something I'm doing inside u64.__tostring? sometime variation of this code give a slightly differently-formatted error message that jumps me into the middle of my __tostring method. or maybe printh is having issues dumping so much text to the console? I dunno

[ Continue Reading.. ]

2 comments



This is #bubblecat-0

  • It doesn't reload properly (launch it and then press ctrl-R; an "attempt to call a string value" error message appears, and is very different from the normal error messages. pico-8 is unresponsive after this)
  • It does reload fine through the menu (press P; choose "reset cart")

Cart #bubblecat-0 | 2021-11-20 | Code ▽ | Embed ▽ | No License
3


This is #bubblecat-2

  • It reloads just fine (using both methods)
  • However, reloading with ctrl-R causes a strange "loaded external changes" message

Cart #bubblecat-2 | 2021-11-20 | Code ▽ | Embed ▽ | No License
3

[ Continue Reading.. ]

1
2 comments



Cart #bubblecat-2 | 2021-11-20 | Code ▽ | Embed ▽ | No License
3

welcome back, bubble cat. we have another situation, and this time you've only got 60 seconds

how to play:

  • arrow keys: move
  • ctrl-m: mute
  • X/Z: continue to next level

you don't have to full-clear every level! skipping a level without clearing it just gives you a points penalty (-5 per remaining bubble)

code:

this game was made to fit inside two tweets; i.e. <560 characters of code and no sprites! here's the full code:

x=3y=3o={}m=0n=0p=circfill::_::z={}for j=1,13do
z[j]=rnd(49)\1end?"⁶!5f2cC"
while t()<60do?"⁶1⁶c"
b=btnp()q=b>8and"⁷fdc"d=sgn(n-m)u=x

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=100464#p)
3
0 comments



I was messing around with the new p8scii memset command, and it sometimes crashes my console at weird times. once, it crashed when I did this:

?"\^!0000"

(i.e. using memset with an address but no actual arguments)

Another time I did a similar command and then did "reboot", and it crashed then


system info: pico-8 0.2.3 / windows 7

the error message:
> Microsoft Visual C++ Runtime Library
>
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.

0 comments



Cart #firroref-0 | 2021-10-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Here's some code:

poke(0x5f5e,0x11) --only enable bitplane 1
sset(0,0,15) --edit sprite 0

I would expect the sset() call to set the spritesheet's corner to color 1 (dark blue) because of the bitplane setting. However, this instead sets the corner to 15 (tan).

I can workaround this for now by using pset and then memcopying the screen to the spritesheet, but that means my decompression code (which wants to call sset with bitplanes active) will need to either take less than a frame to run, or show artifacts onscreen while it runs.

1
2 comments



I just found out that you can turn a specific sprite into the icon for the binary export: https://www.lexaloffle.com/dl/docs/pico-8_manual.html#Binary_Applications_ and whoa, this is really great! But afaict it's restricted to the standard palette. Is there some way to set a custom palette for the icon in the export? If not, adding some sort of palette flag might be a nice feature:

EXPORT -I 32 -C 12 -Z 0,132,4,140,134,6,135,7,8,137,139,11,138,130,13,131 MYGAME.BIN

or maybe reuse the -C flag, and a -1 entry means transparent?

EXPORT -I 32 -C 0,132,4,140,134,6,135,7,8,137,139,11,-1,130,13,131 MYGAME.BIN

(although that might be a bit awkward because using pal(12,-1,1) ingame means to map 12->0x8F, not 12->transparent...)

0 comments



Cart #freecell1k-0 | 2021-09-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
12

Free Cell, in 1022 characters of code, and no sprites! twitter | itch

CONTROLS:

  • click and drag cards around
    • you cannot move stacks of cards; one at a time only!
  • stack descending cards of alternating colors in the main play area
    • any card may be placed in an empty column of the main area
  • store any card in the four "free cells" at the top left
  • make a stack of each suit A->K in the top right to win
  • reset the cart to start a new game

ONE AT A TIME?

You can only move one card at a time; if you want to move a stack of cards you have to take it apart and put it back together manually. This is different from "standard" solitaire, and it makes Free Cell particularly interesting! It also makes the implementation a bit easier to fit into the tiny code-size constraint ;)

[ Continue Reading.. ]

12
3 comments



Cart #constantcompanion-8 | 2022-09-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
27

controls:

This is a niche tool to help you save characters when writing carts that are codesize-constrained.

  • type in a number; press enter
  • then press up/down and ctrl-c/enter to copy a code
  • navigate back up (or press backspace) to start typing a new number

Example: 0x6000 can be written as 0x6000 (6 chars), 24576 (5 chars), 6^13 (4 chars) or ⌂-🐱 (3 chars!)

The tool sorts the results by character count (on twitter), so the top results are your best bet.

Update: The latest versions of pico8 have special P8SCII codes for poking which are often fewer characters than calling poke directly (even after using this tool). e.g. ?"\^!5f10249?" instead of poke(0x5f10,50,52,57,63). Consider using that instead! But this tool might still be useful sometimes, and at the very least, it's an interesting artifact.

[ Continue Reading.. ]

27
7 comments





Top    Load More Posts ->